package study;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author 刘伟涛
 * @Date 2023/8/24 11:14
 **/
public class SortDemo {
    public static void main(String[] args) {
        List<User> list = Arrays.asList(new User(1, "张三", 12),
                new User(2, "李四", 20),
                new User(3, "王五", 9),
                new User(4, "赵六", 14),
                new User(5, "田七", 12));
        list.sort((o1, o2) -> o2.getAge().compareTo(o1.getAge()));
        System.out.println(list);
    }
}
